import java.util.Scanner;

public class Test {
    //写一个递归方法，输入一个非负整数，返回组成它的数字之和
    public static int sum(int n) {
        if(n < 10) {
            return n;
        }
        return n % 10 +sum(n / 10);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ret = sum(sc.nextInt());
        System.out.println(ret);
    }
}